<?php
class ImageCtl extends Ctl{
    function autopng2gif(){
        $pngImg=V('g:pngfile',FALSE);
        //首先判断app/var/image/gen下是否有同名gif文件
        //var_dump($pngImg);
        if($pngImg&&preg_match("/(\w+)\.png$/",$pngImg,$matches)){
            header('Content-Type: image/gif;');
            $_file=__DIR_VAR_IMG_GEN___.$matches[1].'.gif';
            //var_dump($_file);
            if(file_exists($_file)){
                echo file_get_contents($_file);
            }
            else{
                echo file_get_contents(DS('image/conversion.png2gif','',$pngImg));
            }
        }
    }
    
}
?>